﻿using System;

namespace CommandBlock
{
    /// <summary>
    /// 栈
    /// </summary>
    public class TStack
    {
        public int top = -1;

        public int maxSize = 64;

        public Object[] array = new Object[64];

        public void Push(Object val)
        {
            if (top == maxSize - 1) return;
            array[++top] = val;
        }

        public Object Pop()
        {
            if (top == -1) return null;
            return array[top--];
        }

        public Object GetTop()
        {
            if (top == -1) return null;
            return array[top];
        }

        public bool IsEmpty()
        {
            if (top == -1) return true;
            return false;
        }
    }
}